package broker

import (
	"gitee.com/tjccc/gomq/mq/protocol"
)

var cmdTable = make(map[protocol.PacketType]*command)

type command struct {
	cmdName  protocol.PacketType
	executor ExecFunc
}

type ExecFunc func(engine *BrokerEngine, params map[string]any, data []byte) protocol.CustomMsg

func RegisterCommand(cmdName protocol.PacketType, executor ExecFunc) {
	cmdTable[cmdName] = &command{
		cmdName:  cmdName,
		executor: executor,
	}
}
